package org.example.service;

import org.apache.ibatis.annotations.Select;
import org.example.entity.Dizhi;
import org.example.mapper.Dizhimapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DizhiService {
    @Autowired
    Dizhimapper dizhimapper;
    /**
     * 查询地址
     * @param username
     * @return
     */
    public List<Dizhi> cx(String username) {
        return dizhimapper.cx(username);
    }

    /**
     * 新增地址
     * @param dizhi
     * @return
     */
    public Integer xz(Dizhi dizhi) {
        dizhimapper.xz(dizhi);
        return  dizhi.getId();
    }

    /**
     * 删除
     * @param username
     * @param id
     * @return
     */
    public void sc(String username, int id) {
        dizhimapper.sc(username,id);
    }
}
